
************************************************************************************************************
*** Code for replication of: The persistent electoral effects of large-scale infrastructure policies
*** Evidence from a rural electrification scheme in Brazil 
*** Authors: Victor Araújo, Marta Arrecthe, and Pablo Beramendi						  
*************************************************************************************************************   



                                     ****************************************************
                                     *** Empirical analysis using municipal-level data
                                     ****************************************************

*** Calling the dataset from your working directory
clear
use "JoP_municipaldata.dta"


*********************************
** Table 2 (online appendix B1): 
*********************************

** Descriptive statistics - municipal-level data

su turnout_00 pt_elected_96 pt_elected_00  npvv2000 npvp2000 npvde2002 npvdf2002 tveDEM2000 tveMDB2000  ///
      tvePP2000 tvePTB2000 tvePT2000 fectot espvida mort5 idhm t_analf18m gini pmpob t_des p_formal ///  
      rdpct pea percent_urb_00 pop_00  light_00 treat  t_freq0a3_10 t_freq4a6_10 t_freq6_10 t_freq11a14_10 ///
      t_freq15a17_10 t_freq18a24_10 pt_v2002 pt_v2006 pt_v2010 pt_v2014 pt_v2018 pt_v2022 ///
	  pt_elected_96 pt_elected_00 pt_elected_04 pt_elected_08 pt_elected_12 

	  
************************	
** Table 1 (main text): 
************************

** The impact of the LPT on the PT’s vote share in the presidential elections (2002-2022) and the school attendance rate for several age-cohorts (2010) - intention to treat estimates using OLS models with clustered standard errors at the state-level


** PANEL A (Outcome: share of votes for the Worker's Party (PT) in the presidential elections)

** Before running regressions:
** 1. You should create an encoding (numeric) version of the state id so that one can cluster the standard errors at the state-level

encode uf, gen(state_id)

** 2. You should create a dummy variable that accounts for the northeast region in Brazil. 
** This is a key control as most of targeted municipalities are located in the northeast region

gen northeast =. 
replace northeast = 0 if region_code == 1
replace northeast = 1 if region_code == 2
replace northeast = 0 if region_code == 3
replace northeast = 0 if region_code == 4
replace northeast = 0 if region_code == 5


***********
** 2002
***********
reg pt_v2002 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
***********
***********
** 2006
***********
reg pt_v2006 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
***********
** 2010
***********
reg pt_v2010 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
***********
** 2014
***********
reg pt_v2014 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
************
** 2018
************
reg pt_v2018 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
************
** 2022
************
reg pt_v2022 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)	 
	 
	 
******************	 
** PANEL B (Outcome: school attendance rate for several age-cohorts, 2010)
******************

**************************************
* School attendance rate (0-3 years)
**************************************
reg t_freq0a3_10 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
*************************************
* School attendance rate (4-6 years)
*************************************
reg t_freq4a6_10 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
***************************************
* School attendance rate (6-10 years)
***************************************
reg t_freq6_10 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
******************************************
* School attendance rate (> 11 < 14 years)
******************************************
reg t_freq11a14_10 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
******************************************
* School attendance rate (> 15 < 17 years)
******************************************
reg t_freq15a17_10 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)
*****************************************
* School attendance rate (> 18 years)
*****************************************
reg t_freq18a24_10 treat espvida fectot mort1 t_env e_anosestudo gini pmpob idhm rdpct pea percent_rural_00 northeast, cluster (state_id)


*********************************
** Table 7 (online appendix H): 
*********************************

* Per capita number of households/facilities connected to the electrical grid through the LPT program in municipalities governed by PT versus municipalities governed by other political parties (2004-2015)

** Before running models:
** 1. You should create the variable "connections per capita" dividing con_pc_* by the populations of municitions (pop_00) in 2000

** Number of connections per capita in 2004
gen con_pc_04 = connect_2004/pop_00
** Number of connections per capita between 2005 and 2008
gen con_pc_05_08 = connect_05_08/pop_00
** Number of connections per capita between 2009 and 2012
gen con_pc_09_12 = connect_09_12/pop_00
** Number of connections per capita between 2013 and 2015
gen con_pc_13_15 = connect_13_15/pop_00

** 2. You should create an encoding (numeric) version of the state id so that one can cluster the standard errors at the state-level

encode uf, gen(state_id)

** DV: Per capita number of connections (2004)
reg con_pc_04 pt_elected_00 light_00 percent_rural_00 idhm, cluster (state_id)
** DV: Per capita number of connections (2005-2008)
reg con_pc_05_08 pt_elected_04 light_00 percent_rural_00 idhm, cluster (state_id)
** DV: Per capita number of connections (2009-2012)
reg con_pc_09_12 pt_elected_08 light_00 percent_rural_00 idhm, cluster (state_id)
** DV: Per capita number of connections (2012-2015)
reg con_pc_13_15 pt_elected_12 light_00 percent_rural_00 idhm, cluster (state_id)


*********************************
** Figure 3 (online appendix G): 
*********************************

** Histogram of the running variable
hist margins

***********************************
** Figure 4 (online appendix G): 
**********************************

** RD manipulation test plot  
** The rddensity command is part of the rddensity library/package. One should install this package before running the commands below
rddensity margins
rddensity margins, plot


********************************
** Table 5 (online appendix F):  
********************************

** Formal continuity-based analysis for pretreatment covariates (2000)

** Before running models:

* 1. You should create the variable that express the Local average treatment effect (LATE) around the 85% cutoff

gen late = light_00*treat 

** Political variables
*Voter turnout (local elections, 2000)
reg turnout_00 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Is the elected mayor a member of the PT (1996)
reg pt_elected_96 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Is the elected mayor a member of the PT (2000)
reg pt_elected_00 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of voted parties (Local council election, 2000)
reg npvv2000 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of parties voted in mayoral elections (2000)
reg npvp2000 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of parties voted in state parliament elections (2002)
reg npvde2002 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of parties voted in federal parliament elections (2002)
reg npvdf2002 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of elected council members (PFL)
reg tveDEM2000  light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of elected council members (PMDB)
reg tveMDB2000  light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of elected council members (PPB)
reg tvePP2000 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of elected council members (PTB)
reg tvePTB2000 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
*Number of elected council members (PT)
reg tvePT2000 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)


** Socio-economic variables
** Fertility rate
reg fectot light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Life expectancy
reg espvida light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Child mortality
reg mort5 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Human development index (HDI)
reg idhm light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Illiteracy rate
reg t_analf18m light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Income inequality (measured by Gini Index)
reg gini light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Poverty rate
reg pmpob light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Unemployment rate
reg t_des  light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** % of occupations in the formal sector
reg p_formal light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Economically active workforce 
reg pea light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Income per capita
reg rdpct light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Level of urbanization
reg percent_urb_00 light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)
** Population size
reg pop light_00 treat late if light_00 >= 80 & light_00 <= 90, cluster (state_id)






      
                                  ****************************************************
                                  *** Empirical analysis using individual-level data
                                  ****************************************************

								  
*** Calling the dataset from your working directory
clear
use "JoP_surveydata.dta"


*** Transforming (re-categorizing) variables used in the analysis
*** For more details, please check the codebook (individual-level variables)

** Creating a dummy variable to indicate whether or not the respondent is an LPT beneficiary
replace v247 = 0 if v247 ==2
replace v247 = 0 if v247 ==3
replace v243 = 0 if v243 ==2
gen LPT_benef =.
replace LPT_benef = 1 if v243 ==1 | v247 ==1
replace LPT_benef = 0 if LPT_benef==.


*** 2006 Presidential elections
** Creating a dummy variable to indicate whether or not the respondent has voted for PT in the 2006 Brazilian elections
gen first_2006 =.
replace first_2006 = 1 if v145 == 7
replace first_2006 = 0 if v145 == 1
replace first_2006 = 0 if v145 == 2
replace first_2006 = 0 if v145 == 3
replace first_2006 = 0 if v145 == 4
replace first_2006 = 0 if v145 == 5
replace first_2006 = 0 if v145 == 50
replace first_2006 = 0 if v145 == 60
replace first_2006 = . if v145 == 80
replace first_2006 = . if v145 == 90
replace first_2006 = . if v145 == 99


*** 2010 Presidential elections
** Creating a dummy variable to indicate whether or not the respondent has voted for PT in the 2010 Brazilian elections
gen first_2010 =.
replace first_2010 = 1 if v86 == 1
replace first_2010 = 0 if v86 == 2
replace first_2010 = 0 if v86 == 3
replace first_2010 = 0 if v86 == 4
replace first_2010 = 0 if v86 == 5
replace first_2010 = 0 if v86 == 6
replace first_2010 = 0 if v86 == 7
replace first_2010 = 0 if v86 == 50
replace first_2010 = 0 if v86 == 60
replace first_2010 = . if v86 == 80
replace first_2010 = . if v86 == 90
replace first_2010 = . if v86 == 99


** Level of satisfaction with the quality of provision of primary/secondary education
gen basic_educ = v257 
replace basic_educ = 1 if v257 == 6 
replace basic_educ = 1 if v257 == 7 
replace basic_educ = 1 if v257 == 8 
replace basic_educ = 1 if v257 == 9
replace basic_educ = 1 if v257 == 10
replace basic_educ = 0 if v257 == 1
replace basic_educ = 0 if v257 == 2
replace basic_educ = 0 if v257 == 3
replace basic_educ = 0 if v257 == 4
replace basic_educ = 0 if v257 == 5
replace basic_educ = . if v257 == 11
replace basic_educ = . if v257 == 12


** Level of satisfaction with the quality of provision of tertiary education
gen advanced_educ = v258 
replace advanced_educ = 1 if v258 == 6 
replace advanced_educ = 1 if v258 == 7 
replace advanced_educ = 1 if v258 == 8 
replace advanced_educ = 1 if v258 == 9
replace advanced_educ = 1 if v258 == 10
replace advanced_educ = 0 if v258 == 1
replace advanced_educ = 0 if v258 == 2
replace advanced_educ = 0 if v258 == 3
replace advanced_educ = 0 if v258 == 4
replace advanced_educ = 0 if v258 == 5
replace advanced_educ = . if v258 == 11
replace advanced_educ = . if v258 == 12



*****************************************************
**** Individuals's sociodemographic caracteristics
*****************************************************

** Age
gen age =.
replace age = 1 if FXIDADE ==1
replace age = 2 if FXIDADE ==2
replace age = 3 if FXIDADE ==3
replace age = 4 if FXIDADE ==4
replace age = 5 if FXIDADE ==5
replace age = 6 if FXIDADE ==6
replace age = 6 if FXIDADE ==6

** Sex
gen sex =. 
replace sex = 1 if SEXO ==1
replace sex = 0 if SEXO ==2

** Maritual status (married vs others)
gen married =.
replace married = 1 if ESTCIVIL ==1
replace married = 0 if ESTCIVIL ==2
replace married = 0 if ESTCIVIL ==3
replace married = 0 if ESTCIVIL ==4
replace married = 0 if ESTCIVIL ==5
replace married = 0 if ESTCIVIL ==6
replace married = 0 if ESTCIVIL ==90

** Race (Black)
gen black =. 
replace black = 1 if COR ==2
replace black = 0 if COR ==3
replace black = 0 if COR ==4
replace black = 0 if COR ==5
replace black = 0 if COR ==1
replace black = . if COR ==80

** Religion (Christian)
gen religion =.
replace religion = 1 if RELIGI ==1
replace religion = 1 if RELIGI ==2
replace religion = 1 if RELIGI ==3
replace religion = 1 if RELIGI ==8
replace religion = 0 if RELIGI ==4
replace religion = 0 if RELIGI ==5
replace religion = 0 if RELIGI ==6
replace religion = 0 if RELIGI ==7
replace religion = 0 if RELIGI ==9
replace religion = 0 if RELIGI ==10
replace religion = 0 if RELIGI ==11
replace religion = 0 if RELIGI ==12
replace religion = 0 if RELIGI ==13
replace religion = 0 if RELIGI ==70
replace religion = 0 if RELIGI ==80
replace religion = 0 if RELIGI ==88
replace religion = 0 if RELIGI ==99

** Years of schooling
gen schooling = ESC

** Individual income
gen income_individ =.
replace income_individ = 1 if FXRENDAIND ==1
replace income_individ = 1 if FXRENDAIND ==8
replace income_individ = 2 if FXRENDAIND ==2
replace income_individ = 3 if FXRENDAIND ==3
replace income_individ = 4 if FXRENDAIND ==4
replace income_individ = 5 if FXRENDAIND ==5
replace income_individ = 6 if FXRENDAIND ==6
replace income_individ = 7 if FXRENDAIND ==7
replace income_individ = . if FXRENDAIND ==9

** Household income
gen income_house =.
replace income_house = 1 if FXRENDAF ==1
replace income_house = 2 if FXRENDAF ==2
replace income_house = 3 if FXRENDAF ==3
replace income_house = 4 if FXRENDAF ==4
replace income_house = 5 if FXRENDAF ==5
replace income_house = 6 if FXRENDAF ==6
replace income_house = 7 if FXRENDAF ==7
replace income_house = . if FXRENDAF ==8

*** PBF beneficiary
** Creating a dummy variable to indicate whether or not the respondent is an Bolsa Familia (PBF) beneficiary
** You is a beneficiary
replace v241 = 0 if v241 ==2
** Someone in your household
replace v245 = 0 if v245 ==2
replace v245 = 0 if v245 ==3
** Creating a new variable combining v241 and v245
gen PBF_benef =.
replace PBF_benef = 1 if v241 ==1 | v245 ==1
replace PBF_benef = 0 if PBF_benef==.

*** Evaluation of country's economy
gen evalu_econ=.
replace evalu_econ = 1 if v234 ==1
replace evalu_econ = 1 if v234 ==2
replace evalu_econ = 0 if v234 ==3
replace evalu_econ = 0 if v234 ==4
replace evalu_econ = 0 if v234 ==5
replace evalu_econ = 0 if v234 ==6


*********************************************
**** Individuals's attitudes and preferences 
*********************************************

** Support for democracy
gen supp_demo =.
replace supp_demo  = 1 if v84 ==1
replace supp_demo  = 1 if v84 ==2
replace supp_demo  = 0 if v84 ==3
replace supp_demo  = 0 if v84 ==4
replace supp_demo  = 0 if v84 ==5
replace supp_demo  = 0 if v84 ==6
replace supp_demo  = 0 if v84 ==7


** Satisfaction with democracy (very satisfied + satisfied)
gen satis_demo =.
replace satis_demo  = 1 if v83 ==1
replace satis_demo  = 1 if v83 ==2
replace satis_demo  = 0 if v83 ==3
replace satis_demo  = 0 if v83 ==4
replace satis_demo  = 0 if v83 ==5
replace satis_demo  = 0 if v83 ==6
replace satis_demo  = 0 if v83 ==7


** Voter turnout
** Dummy variable to indicate whether the respondent voted in 2010 or not
gen turnout_10 =.
replace turnout_10 = 1 if v85 ==1
replace turnout_10 = 0 if v85 ==2
replace turnout_10 = 0 if v85 ==3
replace turnout_10 = 0 if v85 ==4
replace turnout_10 = 0 if v85 ==5
replace turnout_10 = 0 if v85 ==6
replace turnout_10 = 0 if v85 ==7


*** Party identification (i.e., if the respondent classified herself as identified with Worker's Party, PT)
gen petista =.
replace petista = 1 if v41 ==4
replace petista = 0 if v41 ==1
replace petista = 0 if v41 ==2
replace petista = 0 if v41 ==3
replace petista = 0 if v41 ==5
replace petista = 0 if v41 ==6
replace petista = 0 if v41 ==7
replace petista = 0 if v41 ==8
replace petista = 0 if v41 ==9
replace petista = 0 if v41 ==10
replace petista = 0 if v41 ==13
replace petista = 0 if v41 ==14
replace petista = 0 if v41 ==16
replace petista = 0 if v41 ==18
replace petista = 0 if v41 ==21
replace petista = 0 if v41 ==25
replace petista = 0 if v41 ==26
replace petista = 0 if v41 ==27
replace petista = 0 if v41 ==80
replace petista = 0 if v41 ==90
replace petista = 0 if v41 ==99


** Evaluation of Political Parties
gen evalu_polpart =.
replace evalu_polpart = 1 if v159 ==1
replace evalu_polpart = 1 if v159 ==2
replace evalu_polpart = 0 if v159 ==3
replace evalu_polpart = 0 if v159 ==4
replace evalu_polpart = 0 if v159 ==5
replace evalu_polpart = 0 if v159 ==6
replace evalu_polpart = 0 if v159 ==7
replace evalu_polpart = 0 if v159 ==8


** Evaluation of the Federal Government
gen evalu_govfed =.
replace evalu_govfed = 1 if v156 == 1
replace evalu_govfed = 1 if v156 == 2
replace evalu_govfed = 0 if v156 == 3
replace evalu_govfed = 0 if v156 == 4
replace evalu_govfed = 0 if v156 == 5
replace evalu_govfed = 0 if v156 == 6
replace evalu_govfed = 0 if v156 == 7
replace evalu_govfed = 0 if v156 == 8



**********************************
** Table 1 (online appendix B2): 
**********************************

** Descriptive statistics - Individual-level data

 su first_2006 first_2010 turnout_10 satis_demo supp_demo LPT_benef PBF_benef age sex married black religion ///
  schooling income_individ income_house petista evalu_econ evalu_govfed evalu_polpart basic_educ advanced_educ 


*************************
** Tables 2 (main text): 
*************************

** The impact of the LPT on the PT's vote support by income groups

** Outcome: benefiting from the LPT (models 1-3)
*** Full sample 
reg LPT_benef treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO, cluster(munic_id)
*** Poor respondents
reg LPT_benef treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO if FXRENDAIND >=1 & FXRENDAIND <= 4, cluster (munic_id)
*** Not poor respondents
reg LPT_benef treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO if FXRENDAIND >=4 & FXRENDAIND <= 8, cluster (munic_id)

** Outcome: Voted PT in 2006 (models 4-6)
** Full sample
reg first_2006 treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO, cluster (munic_id)
*** Poor respondents
reg first_2006 treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO if FXRENDAIND >=1 & FXRENDAIND <= 4, cluster (munic_id)
*** Not poor respondents
reg first_2006 treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO if FXRENDAIND >=4 & FXRENDAIND <= 8, cluster (munic_id)


** Outcome: Voted PT in 2010 (models 7-9)
** Full sample
reg first_2010 treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO, cluster (munic_id)
*** Poor respondents
reg first_2010 treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO if FXRENDAIND >=1 & FXRENDAIND <= 4, cluster (munic_id)
*** Not poor respondents
reg first_2010 treat age sex married black religion schooling PBF_benef evalu_econ petista i.ESTADO if FXRENDAIND >=4 & FXRENDAIND <= 8, cluster (munic_id)



********************************
** Table 3 (online appendix C)
********************************

** Baseline (without controls) - Intention to treat (ITT) estimates using individual-level data
** The impact of the LPT on the PT's vote support by income

** Outcome: benefiting from the LPT (models 1-3)
*** Full sample 
reg LPT_benef treat i.ESTADO, cluster (munic_id)
*** Poor respondents
reg LPT_benef treat i.ESTADO if FXRENDAIND >=1 & FXRENDAIND <= 4, cluster (munic_id)
*** Not poor respondents
reg LPT_benef treat i.ESTADO if FXRENDAIND >=4 & FXRENDAIND <= 8, cluster (munic_id)


** Outcome: Voted PT in 2006 (models 4-6)
*** Full sample
reg first_2006 treat i.ESTADO, cluster (munic_id)
*** Poor respondents
reg first_2006 treat i.ESTADO if FXRENDAIND >=1 & FXRENDAIND <= 4, cluster (munic_id)
*** Not poor respondents
reg first_2006 treat i.ESTADO if FXRENDAIND >=4 & FXRENDAIND <= 8, cluster (munic_id)


** Outcome: Voted PT in 2010 (models 7-9)
** Full sample
reg first_2010 treat i.ESTADO, cluster (munic_id)
*** Poor respondents
reg first_2010 treat i.ESTADO if FXRENDAIND >=1 & FXRENDAIND <= 4, cluster (munic_id)
*** Not poor respondents
reg first_2010 treat i.ESTADO if FXRENDAIND >=4 & FXRENDAIND <= 8, cluster (munic_id)



**************************
** Table 3 (main text): 
**************************

** The impact of the LPT on the PT's vote support and the perception of the quality of education
** Fuzzy regression discontinuity (FRD) design using a linear fit and without distric-level fixed effects

****************************
** Outcome: Voted PT in 2006 
****************************

*Selecting the optimal bandwidth
rdbwselect first_2006 light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.433) b(11.825) vce(nncluster munic_id) all 

****************************
** Outcome: Voted PT in 2010
****************************

*Selecting the optimal bandwidth
rdbwselect first_2010 light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.810) b(14.266) vce(nncluster munic_id) all 

****************************
** Outcome: Satisfaction with primary/seondary education
****************************

*Selecting the optimal bandwidth
rdbwselect basic_educ light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.708) b(7.528) vce(nncluster munic_id) all

****************************
** Outcome: Satisfaction with tertiary education 
****************************

*Selecting the optimal bandwidth
rdbwselect advanced_educ light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.420) b(8.980) vce(nncluster munic_id) all 



**********************************
** Table 4 (online appendix D): 
**********************************

** The impact of the LPT on the PT's vote support and the perception of quality of education
** Fuzzy regression discontinuity (FRD) design using a quadratic fit and without distric-level fixed effects

*****************************
** Outcome: Voted PT in 2006 
*****************************

*Selecting the optimal bandwidth
rdbwselect first_2006 light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(2) kernel(triangular) h(8.433) b(11.825) vce(nncluster munic_id) all 

*****************************
** Outcome: Voted PT in 2010
*****************************

*Selecting the optimal bandwidth
rdbwselect first_2010 light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(2) kernel(triangular) h(8.810) b(14.266) vce(nncluster munic_id) all 

****************************
** Outcome: Satisfaction with primary/seondary education
****************************

*Selecting the optimal bandwidth
rdbwselect basic_educ light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(2) kernel(triangular) h(4.708) b(7.528) vce(nncluster munic_id) all

****************************
** Outcome: Satisfaction with tertiary education 
****************************

*Selecting the optimal bandwidth
rdbwselect advanced_educ light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(2) kernel(triangular) h(4.420) b(8.980) vce(nncluster munic_id) all 



*******************************
** Table 9 (online appendix J): 
*******************************

** The impact of the LPT on the PT's vote support and the perception of quality of education
** Using a linear fit and with distric-level fixed effects

****************************
** Outcome: Voted PT in 2006 
****************************

*Selecting the optimal bandwidth
rdbwselect first_2006 light_00, covs(ESTADO) c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust first_2006 light_00, covs(ESTADO) c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.202) b(11.386) vce(nncluster munic_id) all 

****************************
** Outcome: Voted PT in 2010
****************************

*Selecting the optimal bandwidth
rdbwselect first_2010 light_00, covs(ESTADO) c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust first_2010 light_00, covs(ESTADO) c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.305) b(15.259) vce(nncluster munic_id) all 

****************************
** Outcome: Satisfaction with primary/seondary education
****************************

*Selecting the optimal bandwidth
rdbwselect basic_educ light_00, covs(ESTADO) c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust basic_educ light_00, covs(ESTADO) c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.708) b(7.472) vce(nncluster munic_id) all

****************************
** Outcome: Satisfaction with tertiary education 
****************************

*Selecting the optimal bandwidth
rdbwselect advanced_educ light_00, covs(ESTADO) c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust advanced_educ light_00, covs(ESTADO) c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.695) b(9.414 ) vce(nncluster munic_id) all



**************************
** Figure 2 (main text) 
**************************

** BW est.(h) sensitiveness (Panels E-H) of FRD estimates reported in Table 3
  
** Panel E (voted PT in 2006) - the estimated values are compiled in the file "df_panelE_figure2_main.csv"
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.133) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_1 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.233) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_2 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.333) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_3 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.433) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_4 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.533) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_5 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.633) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_6 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.733) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_7 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.833) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_8 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.933) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_9 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.033) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_10 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.133) b(11.825) vce (nncluster munic_id)all level(90)
estimate store a_11 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.233) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_12 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.333) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_13 
*** MSE-Optimal BW selection
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.433) b(11.825) vce(nncluster munic_id) all level(90)
estimate store a_14 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.533) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_15 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.633) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_16 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.733) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_17 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.833) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_18 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.933) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_19 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.033) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_20 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.133) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_21 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.233) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_22 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.333) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_23 
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.433) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_24
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.533) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_25
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.633) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_26
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.733) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_27      
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.833) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_28  
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.933) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_29
rdrobust first_2006 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(10.033) b(11.825) vce (nncluster munic_id) all level(90)
estimate store a_30    



** Panel F (voted PT in 2010) - the estimated values are compiled in the file "df_panelF_figure2_main.csv"
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.510) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_1 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.610) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_2 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.710) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_3 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.810) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_4 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.910) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_5 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.010) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_6 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.110) b(14.266) vce (nncluster munic_id)all level(90)
estimate store a_7 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.210) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_8 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.310) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_9 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.410) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_10 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.510) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_11 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.610) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_12 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.710) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_13 
*** MSE-Optimal BW selection
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.810) b(14.266) vce(nncluster munic_id) all level(90)
estimate store a_14 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.910) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_15 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.010) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_16 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.110) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_17 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.210) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_18 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.310) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_19 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.410) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_20 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.510) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_21 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.610) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_22 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.710) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_23 
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.810) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_24
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.910) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_25
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(10.010) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_26
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(10.110) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_27      
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(10.220) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_28  
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(10.320) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_29
rdrobust first_2010 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(10.420) b(14.266) vce (nncluster munic_id) all level(90)
estimate store a_30    
	 
	 
** Panel G (satistication with primary education) - the estimated values are compiled in the file "df_panelG_figure2_main.csv"	 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.408) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_1
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.308) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_2 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.208) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_3 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.108) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_4 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.008) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_5 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.908) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_6 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.808) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_7 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.708) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_8 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.608) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_9
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.508) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_10
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.408) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_11
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.308) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_12      
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.208) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_13  
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.108) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_14    	 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.008) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_15 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.908) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_16 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.808) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_17 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.708) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_18 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.608) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_19 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.508) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_20 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.408) b(7.528) vce (nncluster munic_id)all level(90)
estimate store a_21 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.308) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_22 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.208) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_23 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.108) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_24 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.008) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_25 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.908) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_26 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.808) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_27 
*** MSE-Optimal BW selection
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.708) b(7.528) vce(nncluster munic_id) all level(90)
estimate store a_28 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.608) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_29 
rdrobust basic_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.508) b(7.528) vce (nncluster munic_id) all level(90)
estimate store a_30 

	 
** Panel H (satistication with tertiary education) - the estimated values are compiled in the file "df_panelH_figure2_main.csv"
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.220) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_1
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.120) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_2 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.920) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_3 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.820) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_4 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.720) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_5 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.620) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_6 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.520) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_7 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.420) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_8 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.320) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_9
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.220) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_10
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.120) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_11
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(6.020) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_12      
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.920) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_13  
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.820) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_14    	 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.720) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_15 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.620) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_16 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.520) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_17 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.420) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_18 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.320) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_19 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.220) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_20 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.120) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_21 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(5.020) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_22 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.920) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_23 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.820) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_24 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.720) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_25 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.620) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_26 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.520) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_27 
*** MSE-Optimal BW selection
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.420) b(8.980) vce(nncluster munic_id) all level(90) 
estimate store a_28 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.320) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_29 
rdrobust advanced_educ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.220) b(8.980) vce (nncluster munic_id) all level(90)
estimate store a_30 
	 
	 
	 
********************************	 
** Table 8 (online appendix I) 
********************************

** Formal continuity-based analysis for individual-level covariates (2010)	 

*********	 
** Age	 
*********	 
*Selecting the optimal bandwidth
rdbwselect age light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust age light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.671) b(16.712) vce(nncluster munic_id) all

**********
** Male
**********
rdbwselect sex light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust sex light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(10.850) b(16.647) vce(nncluster munic_id) all

***********
** Married
***********
rdbwselect married light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust married light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(11.723) b(16.616) vce(nncluster munic_id) all

*******************************
** Race (Black versus others)
*******************************
rdbwselect black light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust black light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(2.864) b(8.977) vce(nncluster munic_id) all

***********************************
** Religion (Christians vs others)
***********************************
rdbwselect religion light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust religion light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.951) b(16.237) vce(nncluster munic_id) all

**************
** Schooling
**************
rdbwselect schooling light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust schooling light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.802) b(15.700) vce(nncluster munic_id) all

***********************
** Income (individual)
***********************
rdbwselect income_individ light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust income_individ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.239) b(12.874) vce(nncluster munic_id) all

***********************
** Income (household)
***********************
rdbwselect income_house light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust income_house light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.406) b(11.739) vce(nncluster munic_id) all

************************
** Bolsa Família benef. 
************************
rdbwselect PBF_benef light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust PBF_benef light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(7.129) b(9.674) vce(nncluster munic_id) all

*************************
** Evaluation of economy
*************************
rdbwselect evalu_econ light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust evalu_econ light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.901) b(12.369) vce(nncluster munic_id) all
 
**************************
** Support for democracy
**************************
rdbwselect supp_demo light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust supp_demo light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.671) b(16.712) vce(nncluster munic_id) all

********************************
** Satisfaction with democracy
********************************
rdbwselect satis_demo light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust satis_demo light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(9.318) b(12.750) vce(nncluster munic_id) all

*********************
** Voter turnout_00
*********************
rdbwselect turnout_10 light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust turnout_10 light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.010) b(10.430) vce(nncluster munic_id) all

******************************
** Party preference (Petista)
******************************
rdbwselect petista light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust petista light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(10.533) b(12.892) vce(nncluster munic_id) all

************************************
** Evaluation of political parties
************************************
rdbwselect evalu_polpart light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust evalu_polpart light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(8.162) b(12.231) vce(nncluster munic_id) all

*************************************
** Evaluation of federal government
*************************************
rdbwselect evalu_govfed light_00, c(85) fuzzy(LPT_benef) vce (nncluster munic_id) all
*Getting the FRD estimates
rdrobust evalu_govfed light_00, c(85) fuzzy(LPT_benef) p(1) kernel(triangular) h(4.133) b(7.467) vce(nncluster munic_id) all




	  	 
	 
	 
	 





 
 
 



























